package com.medsci.yxdplus.controller;


import com.medsci.yxdplus.entity.Users;
import com.medsci.yxdplus.service.UsersService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 销售表 前端控制器
 * </p>
 *
 * @author wenjoying@126.com
 * @since 2019-09-24
 */
@Api(value = "用户", tags = "User")
@RestController
@RequestMapping("/users")
public class UsersController {

    @Autowired
    private UsersService usersService;

    @ApiOperation(value="用户查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "用户id", required = true, dataType = "String"),
            @ApiImplicitParam(name = "mobile", value = "手机号", required = true, dataType = "String")
    })
    @GetMapping(value = "/list")
    @ResponseStatus(HttpStatus.OK)
    public List<Users> all() {
        return usersService.list();
    }

    @ApiOperation(value = "获取用户详情")
    @GetMapping(value = "/{id}")
    @ResponseStatus(HttpStatus.OK)
    public Users getById(@PathVariable Integer id) {
        return usersService.getById(id);
    }

}

